Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-node: Execution Layer Sync #8968

Merged
merged 4 commits into from
Jan 19, 2024
Merged

op-node: Execution Layer Sync #8968

merged 4 commits into from
Jan 19, 2024

Conversation

trianglesphere
Copy link
Contributor

@trianglesphere trianglesphere commented Jan 12, 2024

Description

This passes unsafe payloads directly the EngineController for immediate
insertion when Execution Layer sync is active. This tells the execution
client to sync to that target. Once the EL sync is complete, the last
unsafe payload is marked as safe. This is required when doing snap sync
because the EL does not have the pre-state required to do the engine
consolidation until the sync is complete.

Tests

I've manually tested this code & also have added an action test.

Metadata

@trianglesphere trianglesphere force-pushed the jg/pass_in_engine_controller branch 2 times, most recently from 812932c to 96024d1 Compare January 13, 2024 00:10
@trianglesphere trianglesphere force-pushed the jg/pass_in_engine_controller branch from 96024d1 to fe72b65 Compare January 13, 2024 00:22
@trianglesphere trianglesphere force-pushed the jg/pass_in_engine_controller branch from fe72b65 to 897fa18 Compare January 13, 2024 00:24
@trianglesphere trianglesphere force-pushed the jg/pass_in_engine_controller branch from 897fa18 to 4077200 Compare January 13, 2024 00:25
@trianglesphere trianglesphere force-pushed the jg/pass_in_engine_controller branch 2 times, most recently from 26f824a to a7c3286 Compare January 17, 2024 03:07
Base automatically changed from jg/pass_in_engine_controller to develop January 17, 2024 05:24
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (90fd9b6) 28.53% compared to head (81a7a87) 0.69%.

❗ Current head 81a7a87 differs from pull request most recent head 000ea84. Consider uploading reports for the commit 000ea84 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #8968       +/-   ##
===========================================
- Coverage    28.53%   0.69%   -27.85%     
===========================================
  Files          166      87       -79     
  Lines         7236    2155     -5081     
  Branches      1235     500      -735     
===========================================
- Hits          2065      15     -2050     
+ Misses        5050    2140     -2910     
+ Partials       121       0      -121     
Flag Coverage Δ
cannon-go-tests ?
chain-mon-tests ?
common-ts-tests ?
contracts-bedrock-tests 0.69% <ø> (ø)
contracts-ts-tests ?
core-utils-tests ?
sdk-next-tests ?
sdk-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

see 79 files with indirect coverage changes

Copy link
Contributor

semgrep-app bot commented Jan 18, 2024

Semgrep found 10 sol-style-return-arg-fmt findings:

Named return arguments to functions must be appended with an underscore (_)

Ignore this finding from sol-style-return-arg-fmt.

@trianglesphere trianglesphere force-pushed the jg/el_sync branch 5 times, most recently from 0aa9f05 to 155d58c Compare January 19, 2024 01:09
@trianglesphere trianglesphere marked this pull request as ready for review January 19, 2024 01:11
Copy link
Contributor

coderabbitai bot commented Jan 19, 2024

Walkthrough

Walkthrough

The changes involve integrating P2P (peer-to-peer) functionality and enhancing synchronization features across several components of a blockchain-related codebase. New methods and configurations have been added to handle P2P connections, sync status, and unsafe payload insertion. Modifications to the test suites suggest that these features are also being verified for correctness and stability. The changes indicate a focus on networking capabilities and data consistency within the system.

Changes

Files Change Summary
op-e2e/actions/l2_engine.go
op-e2e/actions/l2_verifier.go
op-node/node/node.go
op-node/rollup/derive/engine_controller.go
op-node/rollup/driver/driver.go
op-node/rollup/driver/state.go
op-program/client/l2/engine.go
op-program/client/l2/engineapi/l2_engine_api.go
Enhanced P2P and synchronization features, including new methods for node interaction and status checking. Adjusted function signatures to accommodate new arguments related to P2P and sync configurations.
op-e2e/actions/l2_sequencer_test.go
op-e2e/actions/l2_verifier_test.go
op-e2e/actions/sync_test.go
op-e2e/system_test.go
op-program/client/l2/engineapi/test/l2_engine_api_tests.go
Updated tests to include P2P settings and synchronization checks. Added imports for Ethereum packages and time handling, and introduced new parameters and assertions.
op-node/rollup/derive/engine_controller.go
op-node/rollup/driver/state.go
Introduced a new syncStatusEnum type with associated constants and logic to handle different synchronization states.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@trianglesphere trianglesphere force-pushed the jg/el_sync branch 2 times, most recently from b376643 to 4286981 Compare January 19, 2024 01:30
Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

op-e2e/actions/sync_test.go Outdated Show resolved Hide resolved
op-node/rollup/derive/engine_controller.go Outdated Show resolved Hide resolved
Copy link
Contributor

@protolambda protolambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good, but I am wondering how we exit a syncing engine status when there is no derivation or p2p activity.

op-e2e/actions/l2_sequencer_test.go Outdated Show resolved Hide resolved
op-node/rollup/driver/state.go Show resolved Hide resolved
Copy link
Contributor

semgrep-app bot commented Jan 19, 2024

Semgrep found 2 sol-style-return-arg-fmt findings:

  • packages/contracts-bedrock/scripts/universal/SafeBuilder.sol: L189, L42

Named return arguments to functions must be appended with an underscore (_)

Ignore this finding from sol-style-return-arg-fmt.

Semgrep found 1 sol-style-malformed-require finding:

  • packages/contracts-bedrock/scripts/universal/SafeBuilder.sol: L173

Malformed require statement style.

Ignore this finding from sol-style-malformed-require.

@trianglesphere trianglesphere added this pull request to the merge queue Jan 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 19, 2024
@trianglesphere trianglesphere added this pull request to the merge queue Jan 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 19, 2024
This passes unsafe payloads directly the EngineController for immediate
insertion when Execution Layer sync is active. This tells the execution
client to sync to that target. Once the EL sync is complete, the last
unsafe payload is marked as safe. This is required when doing snap sync
because the EL does not have the pre-state required to do the engine
consolidation until the sync is complete.
@trianglesphere trianglesphere added this pull request to the merge queue Jan 19, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 19, 2024
@trianglesphere trianglesphere added this pull request to the merge queue Jan 19, 2024
Merged via the queue into develop with commit 770d37f Jan 19, 2024
66 checks passed
@trianglesphere trianglesphere deleted the jg/el_sync branch January 19, 2024 18:32
dshiell pushed a commit to polymerdao/optimism-dev that referenced this pull request Jan 22, 2024
* op-node: Execution Layer Sync

This passes unsafe payloads directly the EngineController for immediate
insertion when Execution Layer sync is active. This tells the execution
client to sync to that target. Once the EL sync is complete, the last
unsafe payload is marked as safe. This is required when doing snap sync
because the EL does not have the pre-state required to do the engine
consolidation until the sync is complete.

* op-e2e: Snap Sync action test

* op-e2e: Actually run TestSystemE2E

* op-service/node: Add time.Since to Clock & use it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snap Sync: Modify op-node to use the P2P unsafe block as the syncing target
3 participants